package com.kgajowy.objects;

import edu.pjwstk.jps.datastore.IOID;
import edu.pjwstk.jps.datastore.ISBAObject;

public class SBAObject<T> implements ISBAObject, Comparable<SBAObject<T> > {

    private String name;
    private DBID id;
    private T value;
    
    public SBAObject(String name, DBID id, T obj){
        this.name = name;
        this.id = id;
        this.value = obj;
    }
    
    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public IOID getOID() {
        return this.id;
    }
    
    public T getObj() {
        return this.value;
    }

    @Override
    public int compareTo(SBAObject<T> o) {
        Integer i1 = new Integer( ((DBID)o.getOID()).getOID() );
        Integer i2 = new Integer( ((DBID)this.getOID()).getOID() );
        
        return (i2.compareTo(i1));
    }

}
